#ifndef PACKETDATA_H
#define PACKETDATA_H

#include <QDataStream>

class PacketData
{
public:
    PacketData(QByteArray data);
    PacketData();
    ~PacketData();

    QString nextString();
    qint32 nextInt();
    quint32 nextUInt();
    qreal nextReal();
    bool atEnd();
    void appendString(const QString& s);
    void appendInt(const qint32& n);
    void appendUInt(const quint32& n);
    void appendReal(const qreal& r);

    const QByteArray& getData() const;

private:
    QDataStream *stream;
    QByteArray data;
};

#endif // PACKETDATA_H
